#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#define ll long long
struct Stu{
    char name[15];
    char id[15];
    double avg;
    struct Stu *next;
}head;

struct Stu* find(char *t){
    struct Stu *p = &head;
    if(p==NULL)return p;
    while(strcmp(t,p->id)!=0){
        p=p->next;
        if(p==NULL)break;
    }
    return p;
}
void printInfo(struct Stu *p){
    printf("Student ID:%s\n",p->id);
    printf("Name:%s\n",p->name);
    printf("Average Score:%.1lf\n",p->avg);
}
int add(){
    char t[15];
    scanf("%s",t);
    if(find(t)!=NULL){
        //printInfo(find(t));
        int t1,t2,t3;
        scanf("%s",t);
        scanf("%d%d%d",&t1,&t2,&t3);
        return 0;
    }
    struct Stu *p = &head;
    while(p->next!=NULL)p=p->next;
    p->next = (struct Stu*)malloc(sizeof(struct Stu));
    p=p->next;
    p->next=NULL;
    strcpy(p->id,t);
    //p->id = tmpid;
    //ll tmp;
    scanf("%s",p->name);
    p->avg=0.0f;
    for(int i=0;i<3;i++){
        int tmp;
        scanf("%d",&tmp);
        p->avg+=tmp;
    }
    p->avg/=3.0;
    //printInfo(p);
    getchar();
    return 1;
}
int del(){
    char t[15];
    scanf("%s",t);
    if(find(t)==NULL)return 0;
    struct Stu *p=&head;
    while(strcmp(p->next->id,t)!=0)p=p->next;
    struct Stu *tmp = p->next;
    p->next=tmp->next;
    //free(tmp);
    return 1;
}
int editAvg(){
    char t[15];
    scanf("%s",t);
    struct Stu *p=find(t);
    if(p==NULL){
        int t1,t2,t3;
        //scanf("%s",t);
        scanf("%d%d%d",&t1,&t2,&t3);
        return 0;
    }
    p->avg=0.0f;
    for(int i=0;i<3;i++){
        int tmp;
        scanf("%d",&tmp);
        p->avg+=tmp;
    }
    p->avg/=3.0;
    return 1;
}
int showAvg(){
    char t[15];
    scanf("%s",t);
    struct Stu *p=find(t);
    if(p==NULL)return 0;
    printInfo(p);
    return 1;
}
int main(){
    int n,tmp;
    head.next=NULL;
    //head.id=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&tmp);
        switch(tmp){
            case 1:if(add()){printf("Add success\n");}else{printf("Students already exist\n");}break;
            case 2:if(del()){printf("Delete success\n");}else{printf("Students do not exist\n");}break;
            case 3:if(editAvg()){printf("Update success\n");}else{printf("Students do not exist\n");}break;
            case 4:if(!showAvg()){printf("Students do not exist\n");}break;
            default:break;
        }
    }
    return 0;
}
